#ifndef BUDDYWND_H
#define BUDDYWND_H

#include <QWidget>
#include <QMap>

class NetworkManager;
class Connection;
class ChatMsg;
class QVBoxLayout;
class QTreeWidgetItem;
class QTreeWidget;
class Connection;
class ChatWnd;

class BuddyWnd : public QWidget
{
Q_OBJECT
public:
    explicit BuddyWnd(QWidget *parent = 0);
    void setNetManager(NetworkManager *pNetManager);
    NetworkManager *netManager();

signals:
    void askForPlaying(Connection *pPeer);

public slots:
    void peerJoined(Connection *pConn);
    void peerLeft(Connection *pConn);
    void chatMsgCame(Connection *pFrom,ChatMsg *pMsg);    
    void buddyDoubleClicked(QTreeWidgetItem *pItem,int nColumn);

private slots:
    void customContextMenutRequestedFromBuddyTree(QPoint ptLocation);
    void peerViewInfoChanged();
    void peerStatusChanged(Connection *pConn);

private:
    void setPeerText(Connection *pConn);

private:
    NetworkManager *mpNetManager;
    QTreeWidget *mpTree;
    QMap<Connection*,QTreeWidgetItem*> mMapConnItem;
    ChatWnd *mpChatWnd;
};

#endif // BUDDYWND_H
